-
-
Notifications
You must be signed in to change notification settings - Fork 74
Make clicking on a match select it on close-on-click (Fixes #149) #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…g#149) Modify `PluginMatch` box to handle GestureClick and claim the event, manually selecting the row. Then also output a `Clicked` event, which is passed on to the main app events. On this event, if `close-on-click` is true, do perform the `Select` action, picking the item and running its result. This changes the behaviour (for close-on-click=true) on clicking menu items, selecting them instead of just closing the application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea seems sound, but I wonder if this should be the default behavior even without close_on_click
set. And if there would be a way to make mouse bindings configurable in a way similar to how keybinds work now.
"And if there would be a way to make mouse bindings configurable in a way similar to how keybinds work now." Yea this would probably be best - would probably want another action for "PickRow" as well, to mark a row as currently selected. Binding the mouse buttons as keybinds did not work (even when they were accepted as correctly spelled). |
Yeah it won't work through the existing keybind config, it would require it's own config entry. This would probably mean having another action type for mouse stuff (something like |
Something like this instead? |
29d8543
to
d6db78a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch needs to be rebased since master has changed a lot with the provider branch being merged.
Select, | ||
Up, | ||
Down, | ||
Nop, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of having a Nop action?
pub enum PluginBoxOutput { | ||
MatchesLoaded, | ||
RowSelected(<PluginBox as FactoryComponent>::Index), | ||
MouseAction( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is complex enough where it could be structified in the enum, as in:
MouseAction {
button: MouseButton,
...
}
.find(|mousebind| mousebind.button == button) | ||
{ | ||
// Potentially select row | ||
match action { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of preprocessing of actions feels a bit ugly, I'd prefer if there was a general enum for mouse actions/events as a part of AppMsg
, so that the mouse bindings could be extended to be the way close on click works is that it's just a mouse binding. And maybe deprecating that option as well.
In practice the mouse action part of AppMsg
would contain all the different kinds of mouse actions/events that different callbacks will produce, and then the handler for the mouse actions specifically can do the required preprocessing before sending another action, if necessary/applicable.
Modify
PluginMatch
box to handle GestureClick and claim the event, manually selecting the row. Then also output aClicked
event, which is passed on to the main app events.On this event, if
close-on-click
is true, do perform theSelect
action, picking the item and running its result.This changes the behaviour (for close-on-click=true) on clicking menu items, selecting them instead of just closing the application.